package com.osell.selection.data.network.entity;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

public class Product implements Serializable {

    @SerializedName("id")
    public String id;
    @SerializedName("name")
    public String name;
    @SerializedName("sub_title")
    public String subTitle;
    @SerializedName("products_type")
    public String type;
    @SerializedName("product_number")
    public String number;
    @SerializedName("cover_img_url")
    public String posterUrl;
    @SerializedName("bigimage")
    public String imageUrl;
    @SerializedName("jpg_url")
    public String jpgUrl;
    @SerializedName("video_link")
    public String videoLink;
    @SerializedName("pricespe")
    public String price;

    @SerializedName("reward_count")
    public String rewardCount;

    @SerializedName("store_id")
    public String storeId;
    @SerializedName("store_name")
    public String storeName;

    @SerializedName("isopenweb")
    public Integer webFlag;
    @SerializedName("openweb_url")
    public String webUrl;
    // use for the Store fragment
    public String storeTagName;


    public static class MoreProduct extends Product {
        public static MoreProduct convertFrom(Product product) {
            MoreProduct moreProduct = new MoreProduct();
            moreProduct.id = product.id;
            moreProduct.name = product.name;
            moreProduct.subTitle = product.subTitle;
            moreProduct.type = product.type;
            moreProduct.number = product.number;
            moreProduct.posterUrl = product.posterUrl;
            moreProduct.imageUrl = product.imageUrl;
            moreProduct.jpgUrl = product.jpgUrl;
            moreProduct.videoLink = product.videoLink;
            moreProduct.rewardCount = product.rewardCount;
            moreProduct.storeId = product.storeId;
            moreProduct.storeName = product.storeName;
            moreProduct.webFlag = product.webFlag;
            moreProduct.webUrl = product.webUrl;
            return moreProduct;
        }
    }

    public static class OneProduct extends Product {
        public static OneProduct convertFrom(Product product) {
            OneProduct oneProduct = new OneProduct();
            oneProduct.id = product.id;
            oneProduct.name = product.name;
            oneProduct.subTitle = product.subTitle;
            oneProduct.type = product.type;
            oneProduct.number = product.number;
            oneProduct.posterUrl = product.posterUrl;
            oneProduct.imageUrl = product.imageUrl;
            oneProduct.jpgUrl = product.jpgUrl;
            oneProduct.videoLink = product.videoLink;
            oneProduct.rewardCount = product.rewardCount;
            oneProduct.storeId = product.storeId;
            oneProduct.storeName = product.storeName;
            oneProduct.webFlag = product.webFlag;
            oneProduct.webUrl = product.webUrl;
            return oneProduct;
        }
    }

    public static class VideoProduct extends Product {
        public static VideoProduct convertFrom(Product product) {
            VideoProduct videoProduct = new VideoProduct();
            videoProduct.id = product.id;
            videoProduct.name = product.name;
            videoProduct.subTitle = product.subTitle;
            videoProduct.type = product.type;
            videoProduct.number = product.number;
            videoProduct.posterUrl = product.posterUrl;
            videoProduct.imageUrl = product.imageUrl;
            videoProduct.jpgUrl = product.jpgUrl;
            videoProduct.videoLink = product.videoLink;
            videoProduct.rewardCount = product.rewardCount;
            videoProduct.storeId = product.storeId;
            videoProduct.storeName = product.storeName;
            videoProduct.webFlag = product.webFlag;
            videoProduct.webUrl = product.webUrl;

            return videoProduct;
        }
    }

    public static class AdProduct extends Product {
        public static AdProduct convertFrom(Product product) {
            AdProduct adProduct = new AdProduct();
            adProduct.id = product.id;
            adProduct.name = product.name;
            adProduct.subTitle = product.subTitle;
            adProduct.type = product.type;
            adProduct.number = product.number;
            adProduct.posterUrl = product.posterUrl;
            adProduct.imageUrl = product.imageUrl;
            adProduct.jpgUrl = product.jpgUrl;
            adProduct.videoLink = product.videoLink;
            adProduct.rewardCount = product.rewardCount;
            adProduct.storeId = product.storeId;
            adProduct.storeName = product.storeName;
            adProduct.webFlag = product.webFlag;
            adProduct.webUrl = product.webUrl;
            return adProduct;
        }
    }
}
